<template>
	<div>
		<el-table :data="accountList"
			minheight="calc(100VH - 270px)" 
			highlight-current-row border style="width: 100%" 
			v-loading="loading"
			element-loading-text="拼命加载中"
			element-loading-spinner="el-icon-loading"
			element-loading-background="rgba(0, 0, 0, 0.8)"
			>
			<el-table-column label="序号" type="index" align="center" width="50"></el-table-column>
			<el-table-column label="交易流水号" prop="journalNo" align="center"></el-table-column>
			<el-table-column label="订单编号" prop="orderCode" align="center"></el-table-column>
			<el-table-column label="支出/收入" prop="inOutFlag" align="center">
				<template slot-scope="scope">
					<span v-if="scope.row.inOutFlag == 1">支出</span>
					<span v-if="scope.row.inOutFlag == 2">收入</span>
				</template>
			</el-table-column>
			<el-table-column label="交易金额" prop="tradeAmount" align="center"></el-table-column>
			<el-table-column label="交易类别" prop="tradeType" align="center" >
				<template slot-scope="scope">
					{{scope.row.tradeType }}
				</template>
			</el-table-column>
			<el-table-column label="创建时间" prop="createTime" align="center" ></el-table-column>
			<template v-if="accountList.length > 0 && accountList.length < totalData">
				<p slot="append" style="text-align:center; line-height:50px;" v-loading="loading">
					<a href="javascript:;"  @click="getMoreData()" class="blue01">点击加载更多</a>
				</p>
			</template>
		</el-table>
	</div>
</template>

<script>
import { findMemberAccountList } from '@/api/crm/member'
export default{
	props: {
		memberCode: String,
		accountType: String
	},
	data(){
		return{
			loading: true,
			accountList:[],
			searchForm:{
				userCode: this.memberCode,
				accountType: this.accountType,
				pageSize: 10, //每页显示条目个数
				pageNum: 1, //当前页
			},
			totalData:0
		}
	},
	created() {
		this.accountList = []
		this.getDataList()
	},
	methods:{
		getDataList(){
			this.loading = true
			findMemberAccountList(this.searchForm).then(res =>{
				console.log(res)
				if(res.data.responseCode == 200){
					res.data.responseData.forEach(item =>{
						this.accountList.push(item)
					})
					this.totalData = parseInt(res.data.total)
				}
			})
			this.loading = false
		},
		getMoreData(){
			this.searchForm.pageNum++
			this.getDataList()
		}
	}
}
</script>

<style>
</style>
